<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<link rel="stylesheet" type="text/css" href="js/layui/css/layui.css"/>
	<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/layer/layer.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<body>
		<div id="add-Stuent" style=";" >
		     
		         <div class="layui-form-item center" >
		          <label class="layui-form-label" style="width: 100px" >课程编号</label>
		          <div class="layui-input-block">
		           <input type="text" name="name" id="studentno" style="width: 240px" lay-verify="required" placeholder="请输入配置名称" autocomplete="off" class="layui-input">
		          </div>
		         </div>
		         <div class="layui-form-item">
		          <label class="layui-form-label" style="width: 100px">课程名称</label>
		          <div class="layui-input-block">
		           <input type="text" name="type" id="studentname" required style="width: 240px" lay-verify="required" placeholder="请输入配置类型" autocomplete="off" class="layui-input">
		          </div>
		         </div>
				 
	            
			    

			
			
		         
		         <div class="layui-form-item">
		          <div class="layui-input-block">
		           <button class="layui-btn" id="courseSave">保存</button>
		          <!-- <button type="button" onreset=""  class="layui-btn" id="closeBtn" >重置</button> -->
		          </div>
		         </div> 
		     
		    </div>
	
	</body>
	
<script>//Demo
layui.use('form', function(){
  var form = layui.form;
  
  //监听提交
  form.on('submit(formDemo)', function(data){
    layer.msg(JSON.stringify(data.field));
    return true;
  });
});

</script>

<script>
	$("#courseSave").click(function(){
			
		var data={
			"courseno":$("#studentno").val(),
			"coursename":$("#studentname").val(),
			
		}
		$.ajax({
			 type:"post",
			   url:"http://127.0.0.1:8080//course/save",
			   dataType: 'json',
			  contentType: "application/json;charset=utf-8",
			   
			data: JSON.stringify(data),
			success:function(msg){
				
					alert(msg.data)
				
			},
			error:function(){
				alert("保存失败了哟");
			}
		})
	})
</script>
</html>
